package cssbox.mytest;

import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.util.Locale;

/**
 * 
 * 
 * 
 * @author Wxg
 *
 */
public class ListFonts {

	public static void main(String[] args) {
		code103();
	}
	
	/**
	 * 摘自:
	 * 《Java核心技术 卷I》 第7章 图形程序设计 7.7 文本使用特殊字体
	 */
	public static void code101(){
		String[] fontNames = GraphicsEnvironment
				.getLocalGraphicsEnvironment()
				.getAvailableFontFamilyNames();
		for(String fontName : fontNames){
			System.out.println(fontName);
		}
	}
	
	public static void code102(){
		String[] fontNames = GraphicsEnvironment
		.getLocalGraphicsEnvironment()
		.getAvailableFontFamilyNames(Locale.CHINA);
		for(String fontName : fontNames){
			System.out.println(fontName);
		}
	}
	
	
	/**
	 * 
fontName: 仿宋, localFontName: 仿宋
fontName: 宋体, localFontName: 宋体
fontName: 微软雅黑, localFontName: 微软雅黑
fontName: 微软雅黑 Bold, localFontName: 微软雅黑 Bold
fontName: 新宋体, localFontName: 新宋体
fontName: 楷体, localFontName: 楷体
fontName: 黑体, localFontName: 黑体
	 * 
	 */
	public static void code103(){
		Font[] fonts = GraphicsEnvironment
		.getLocalGraphicsEnvironment()
		.getAllFonts();
		for(Font font : fonts){
			System.out.printf( "\nfontName: %s, localFontName: %s", font.getFontName(), font.getFontName(Locale.CHINA) );
		}
		
	}
	
}
